package cc.iotkit.temporal.es.document;

import cc.iotkit.model.device.message.DeviceConsumePower;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @Title: cc.iotkit.temporal.es.document
 * @author: Sunne
 * @date: 2024-09-26 14:00
 * @Description: 耗电统计和耗电详情
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Document(indexName = "device_kilowatt_hour")
@AutoMapper(target = DeviceConsumePower.class)
public class DocDeviceConsumePower {

    @Id
    private String id;

    private String deviceId;

    private String productKey;
    /**
     * 设备功耗
     */
    private Double consumePower;
    /**
     * 工作时长
     */
    private Long workTime;
    /**
     * 理论功耗
     */
    private Double theoryConsumePower;
    /**
     * 实际总功耗
     */
    private Double totalConsumePower;
    /**
     * 统计截止时间
     */
    @Field(type = FieldType.Date)
    private Long time;
    /**
     * 所属平台用户ID
     */
    private String uid;

    public DocDeviceConsumePower(String id, String deviceId, String productKey, Double consumePower, Long time, String uid) {
        this.id = id;
        this.deviceId = deviceId;
        this.productKey = productKey;
        this.consumePower = consumePower;
        this.time = time;
        this.uid = uid;
    }
}